package com.hnrd.infomation_collerction.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hnrd.infomation_collerction.model.EntInfoCollectModel;
import com.hnrd.infomation_collerction.pojo.EntInfoCollect;
import com.hnrd.infomation_collerction.service.EntInfoCollectService;
@RequestMapping("enterprise")
@RestController
public class EnterpriseController {
	@Autowired
	private EntInfoCollectService entInfoCollectService;
	
	@PostMapping("insert")
	public ResponseEntity<Map<String, String>> insertEnterpriserInfo(@RequestBody EntInfoCollectModel entInfoCollect){
		entInfoCollect.setWasteProductionInformation(entInfoCollect.toString());
		return entInfoCollectService.insertEntInfoCollect(entInfoCollect);
	}
	
	@GetMapping("selectAllInfo")
	public ResponseEntity<List<EntInfoCollect>> selectAllInfo(@RequestBody Map<String,String> map){
		return entInfoCollectService.slectAll();
	}
}
